package co.edu.udistrital.audiomixer.bean;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

import org.eclipse.emf.texo.server.service.ServiceModelPackageRegistry;
import org.eclipse.emf.texo.server.store.EntityManagerProvider;

import co.edu.udistrital.audiomixer.AudiomixerModelPackage;

@Named
@ApplicationScoped
public class TexoInicializadorBean {

	@PostConstruct
	void inicializar(){
		try {
			ServiceModelPackageRegistry.getInstance().register(AudiomixerModelPackage.INSTANCE);
			EntityManagerProvider.getInstance().setPersistenceUnitName("MixerPU");
			EntityManagerProvider.getInstance().initialize();
		} catch (RuntimeException e) {
			System.err.println("error inicializando texo");
			e.printStackTrace();
		}
		
	}
	
	private String version = "1.1";

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}
	
	
}
